package com.zen.lon.open.remote.utils;

/**
 * @author ZonLen since on 2021/7/9 上午12:03
 */
public final class PathUtils {

  private PathUtils() {
  }

  /**
   * 路径解析 默认第一个
   */
  public static String primaryPath(String[] paths) {
    if (paths.length == 0) {
      return "";
    }
    String path = paths[0].trim();
    if (path.length() == 0) {
      return path;
    }
    if (!path.startsWith("/")) {
      path = "/" + path;
    }
    if (path.endsWith("/")) {
      path = path.substring(0, paths.length - 1);
    }
    return path;
  }

}
